package com.rjkj.medicalwaste.bean

import androidx.room.*

@Entity(indices = [Index(value = ["garbageQRCode"], unique = true)], tableName = "garbage")
data class GarbageBean(
    @PrimaryKey(autoGenerate = true) val id: Int = 0,
    val uploadState: Int = 0x0000,//上传数据状态
    @ColumnInfo(defaultValue = "") val garbageQRCode: String = "", //垃圾袋二维码
    @ColumnInfo(defaultValue = "") val garbageType: String = "", //垃圾类型
    @ColumnInfo(defaultValue = "") val garbageWeight: String = "", //垃圾重量
    @ColumnInfo(defaultValue = "0") var garbageUserStatus: String = GarbageStatus.produce,  //垃圾状态 本地用 服务器用下面的
    @ColumnInfo(defaultValue = "0") val garbageStatus: String = "0",  //垃圾使用状态
    @ColumnInfo(defaultValue = "") val hospitalId: String = "", //医院ID
    @ColumnInfo(defaultValue = "") var hospitalName: String = "", //医院名字
    @ColumnInfo(defaultValue = "") var departmentName: String = "", //科室名字
    @ColumnInfo(defaultValue = "") var nurseQRName: String = "", //医护人员名字
    @ColumnInfo(defaultValue = "") var cleanerName: String = "", //清理工名字
    @ColumnInfo(defaultValue = "") val garbageBoxQRCode: String = "", //箱子二维码
    @ColumnInfo(defaultValue = "") val tempBoxQRCode: String = "", //临时箱子二维码
    @ColumnInfo(defaultValue = "") val departmentQRCode: String = "", //科室二维码
    @ColumnInfo(defaultValue = "") val cleanerQRCode: String = "", //收集阶段清理工二维码
    @ColumnInfo(defaultValue = "") val nurseQRCode: String = "", //医护人员二维码
    @ColumnInfo(defaultValue = "0") val reviewWeightState: String = ReviewWeightState.UnCheck,
    @ColumnInfo(defaultValue = "") val handoverQRCode: String = "", //回收公司人员二维码
    @ColumnInfo(defaultValue = "") val handoverCleanerQRCode: String = "", //清理工二维码
    @ColumnInfo(defaultValue = "0000-00-00 00:00:00") val garbageTime: String = "0000-00-00 00:00:00",  //垃圾回收时间
    @ColumnInfo(defaultValue = "0000-00-00 00:00:00") val garbageChangeTime: String = "0000-00-00 00:00:00",   //垃圾状态变更时间
    @ColumnInfo(defaultValue = "0") val garbageCollectType: String = ReviewWeightModel.Model0,//垃圾收集模式
    @ColumnInfo(defaultValue = "") var reviewDeviceSN: String = "",//复核设备号
    @ColumnInfo(defaultValue = "") var reviewStorageQRCode: String = "",//暂存QRCode
    @ColumnInfo(defaultValue = "0000-00-00 00:00:00") var storageTime: String = "0000-00-00 00:00:00",//入暂存间时间
    @ColumnInfo(defaultValue = "") val garbageBoxDeviceSN: String = "",//操作装箱时的设备号
    @ColumnInfo(defaultValue = "") val garbageBoxPosition: String = "",//垃圾装箱在何处实施  0:暂存间内,1:暂存间外
    @ColumnInfo(defaultValue = "") val garbageBoxType: String = "",//箱子类型
    @ColumnInfo(defaultValue = "") val garbageBoxWeight: String = "",//所有装箱医废的总重
    val garbageCNT: Int = 0,//装箱袋数
    @ColumnInfo(defaultValue = "0000-00-00 00:00:00") val garbageBoxTime: String = "0000-00-00 00:00:00",//装箱时间
    @ColumnInfo(defaultValue = "") val garbageBoxStatus: String = "0",//"垃圾箱是否有异常登记  0:未作修改，1:破损登记，2：泄露登记，3：信息修改，9：已处理；5：未满装箱，6：已满装箱"
    @ColumnInfo(defaultValue = "") val garbageBoxChangePlace: String = "0",//"垃圾箱在何处登记 0:未作修改，1:垃圾回收地，2：暂存间"
    @ColumnInfo(defaultValue = "0000-00-00 00:00:00") val garbageBoxChangeTime: String = "0000-00-00 00:00:00",//箱子状态变更时间
    @ColumnInfo(defaultValue = "") val boxWeight: String = "",//空箱重量
    @ColumnInfo(defaultValue = "") val handoverDeviceSN: String = "",//出库设配号
    @ColumnInfo(defaultValue = "") val garbageChangePlace: String = "0",  //垃圾状态变更地
    @ColumnInfo(defaultValue = "") val garbageDeviceSN: String = "",//小推车平板设备号
    @ColumnInfo(defaultValue = "") var reviewWeight: String = "", //复核重量
    @ColumnInfo(defaultValue = "") var reviewType: String = "", //复核模式
    @ColumnInfo(defaultValue = "0000-00-00 00:00:00") var reviewTime: String = "0000-00-00 00:00:00", //复核时间
    @ColumnInfo(defaultValue = "0000-00-00 00:00:00") val handoverTime: String = "0000-00-00 00:00:00", //出库时间
    @ColumnInfo(defaultValue = "") val totalWeight: String = "", //总量量-----逐箱复核使用
    @ColumnInfo(defaultValue = "") var reviewCleanerQRCode: String = "",
    @ColumnInfo(defaultValue = "") val boxCleanerQRCode: String = "",//封箱清理工二维码
    val garbageCount: Int = 0,
) {
    @Ignore
    var print: Boolean = false//收集打印

    @Ignore
    var syncDeviceSN: String = ""//上传时的设备号

    @Ignore
    var fromControlBox: Boolean = false//是否來自管控箱
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as GarbageBean

        if (garbageQRCode != other.garbageQRCode) return false

        return true
    }

    override fun hashCode(): Int {
        return garbageQRCode.hashCode()
    }

    companion object {
        const val nullState = 0x0000
        const val collectState = 0x0001
        const val storeState = 0x0010
        const val boxState = 0x0100
        const val outboundState = 0x1000
        const val AllState = 0x1111
    }

}